package colbert.content.testFinal;

public class SilverCard extends Card{
    private double discount = 0.9;
    private double discountMoney;
    public SilverCard() {
    }
    public SilverCard(String cardNum, String cardName, String phone, double money) {
        super(cardNum, cardName, phone, money);
    }

    @Override
    public void getMoney(double money){
        discountMoney = money * this.discount;
        System.out.println("正在查询余额：" + this.getMoney());
        System.out.println("正在消费：" + discountMoney) ;
        // 判断余额是否够用
        if(discountMoney>this.getMoney()){
            System.out.println("余额不足");
        }else{
            // 够用，消费
            this.setMoney(this.getMoney()-discountMoney);
            System.out.println("消费成功，余额为："+this.getMoney());
        }
    }
    
}
